use Test::More 'no_plan';

use lib "../lib/cpp", "../lib/ioc", "../lib/toolkit", '../lib/message';

use TinyMessage;
use Set;
use CHeaderParser;

my $classes = new Set();

CHeaderParser::parse(\*DATA, {
	class => sub {
		my $context = shift;
		my $class = $context->classContext();
		$classes->put($class);
	} 
});

ok($classes->value('A1'));
my @ctros = $classes->value('A1')->constructors();
is(@ctros, 3);
my ($c1, $c2, $c3) = 
(
	$classes->value('A1')->constructor(''), 
	$classes->value('A1')->constructor('A2*, A3&, A4'), 
	$classes->value('A1')->constructor('A2*, A3*')
);

ok($c1);
ok($c2);
ok($c2);

is ($c1->visible(), '0');
is ($c2->visible(), '0');
is ($c3->visible(), '1');

ok($classes->value('A2'));
@ctros = $classes->value('A2')->constructors();
is(@ctros, 1);

$c1 = $classes->value('A2')->constructor('');
ok($c1);
is($c1->visible(), '1');

ok($classes->value('A3'));
@ctros = $classes->value('A3')->constructors();
is(@ctros, 1);
$c1 = $classes->value('A2')->constructor('LogService < FileService >*');
ok($c1);
is($c1->visible(), '1');

__DATA__

//no default ctor
class A1 {
private:
	A1() {}
	A1( A2  *a  ,A3&b  , A4 c  );
public:
	A1(A2* d, A3*e) {}	
}

//default ctor
class A2 {
}

class A3 {
public:	
	A3(LogService<FileService>* logService);
}